package com.itrh.base.listener;

import com.itrh.base.service.IPermissionScanService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * ClassName: InitListener
 *
 * @author XHU_WHY
 * @version V1.0
 * @since 2024/4/7 17:02
 */
@WebListener
@Component
@Slf4j
public class InitListener implements ServletContextListener {
    @Resource
    private IPermissionScanService permissionScanService;
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        permissionScanService.scan();
        log.info("------------项目启动------------");
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        log.info("------------项目停止------------");
    }
}
